package com.jvup.gameshow.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.jvup.gameshow.R;
import com.jvup.common.constant.Navigation;
import com.jvup.common.support.base.BaseFragment;
import com.jvup.gameshow.databinding.FragmentHomeBinding;
import com.jvup.gameshow.model.viewModel.impl.HomeViewModel;
import com.qire.antsbinder.viewModel.ViewModelFactory;
import com.qire.antscore.annotation.RouteMapping;

@RouteMapping(path = Navigation.Fragment.HomeFragment)
public class HomeFragment extends BaseFragment<FragmentHomeBinding> {

    HomeViewModel viewModel;

    public static HomeFragment newInstance() {
        Bundle args = new Bundle();
        HomeFragment fragment = new HomeFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public int layoutRid() {
        return R.layout.fragment_home;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View root = super.onCreateView(inflater, container, savedInstanceState);
        viewModel = ViewModelFactory.crate(getActivity(),HomeViewModel.class);
        viewDataBinder().setHomeViewModel(viewModel);
        return root;
    }
}
